package databaseConnect;

import java.util.Vector;

public class RosterExecutionRequests {

	public static Vector<String> getHostRow (int ID){
		return (AccessConnect.executeSelect("SELECT * FROM HostDescription WHERE ID=" + ID)).firstElement();
	}

	public static boolean getHostState (int ScenarioID, int ID){
		Vector<Vector<String>> isActive = AccessConnect.executeSelect("SELECT Active FROM StartConfigurationNodes WHERE ScenarioID=" + ScenarioID + "AND HostID=" + ID);
		return isActive.firstElement().firstElement().equals("1");
	}

	public static String getHostStateAsString (int ScenarioID, int ID){
		Vector<Vector<String>> isActive = AccessConnect.executeSelect("SELECT Active FROM StartConfigurationNodes WHERE ScenarioID=" + ScenarioID + "AND HostID=" + ID);
		return isActive.firstElement().firstElement();
	}
	public static Vector<String> getHostServiceRows (int hostId){
		Vector<Vector <String>> tmp = AccessConnect.executeSelect("SELECT Service FROM HostServices WHERE HostID=" + hostId);
		for (int i= 0 ; i < tmp.size()-1; i++ ){
			tmp.firstElement().add(tmp.get(i).firstElement());
		}
		if (tmp.size() > 0){
			return tmp.firstElement();			
		} 
		return null;
	}
}
